package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.DmcCsunSleepDataInBedMapper;
import com.csun.cmny.provider.model.domain.DmcCsunSleepDataInBed;
import com.csun.cmny.provider.model.dto.app.AppSleepDateQueryDto;
import com.csun.cmny.provider.model.dto.csunsleep.CsunSleepDataInBedQueryDto;
import com.csun.cmny.provider.service.DmcCsunSleepDataInBedService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-02-15 11:03
 * @Description: the class dmc csun sleep data in bed service impl
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DmcCsunSleepDataInBedServiceImpl extends BaseService<DmcCsunSleepDataInBed>
        implements DmcCsunSleepDataInBedService {

    @Resource
    private DmcCsunSleepDataInBedMapper dmcCsunSleepDataInBedMapper;

    @Override
    public List<DmcCsunSleepDataInBed> queryCsunSleepDataInBedList(CsunSleepDataInBedQueryDto csunSleepDataInBedQueryDto) {
        return dmcCsunSleepDataInBedMapper.queryCsunSleepDataInBedList(csunSleepDataInBedQueryDto);
    }

    @Override
    public DmcCsunSleepDataInBed getLatestInBedData(Long deviceId) {
        return dmcCsunSleepDataInBedMapper.getLatestInBedData(deviceId);
    }

    @Override
    public Integer countLeaveBedAlertTimes(AppSleepDateQueryDto appSleepDateQueryDto) {
        return dmcCsunSleepDataInBedMapper.countLeaveBedAlertTimes(appSleepDateQueryDto);
    }
}
